package com.hx.vending.dao;

import com.hx.vending.bean.GoodsConsume;
import com.hx.vending.bean.entity.GoodsConsumeVo;
import com.hx.vending.bean.entity.GoodsRanking;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**`
 * Created by Administrator on 2018/12/5.
 */
@Repository
public interface GoodsConsumeMapper {

    List<Map<String,Object>> getGoodsAmountByFieldId(@Param("fieldList") List<Integer> fieldList, @Param("startTime")String startTime,
                                                              @Param("endTime")String endTime,@Param("userId")Integer userId);
    List<Map<String,Object>> selectAmountAndCountByTime(@Param("userId") Integer userId,@Param("startTime") String startTime,
                                                        @Param("endTime") String endTime,@Param("integers") Integer[] integers);

    List<GoodsConsume> selectByEquipment(@Param("equipmentId")String equipmentId,@Param("userId")Integer userId,
                                         @Param("startTime")String startTime, @Param("endTime")String endTime);

    //添加信息
    int insertSelective(GoodsConsume goodsConsume);

    List<GoodsConsume> selectByExample(GoodsConsume goodsConsume);

    List<Map<String, Object>> getGoodsAmountListByFieldId(@Param("fieldId") Integer fieldId,@Param("startTime") String startTime,
                                                          @Param("endTime") String endTime);

    GoodsConsumeVo selectCountByTime(@Param("userId") Integer userId, @Param("startTime") String startTime,
                                     @Param("endTime") String endTime,@Param("integers") Integer[] integers);

    List<GoodsConsume> selectByFieldId();

    Map<String,Object> selectCountByEquipment(Integer onlineOrderId);

    Map<String,Object> selectConsumeByOrderId(@Param("onlineOrderId") Integer onlineOrderId);

    /**
     * 查询商品销售排行(不分机器，根据用户)
     * @param userId
     * @param startTime
     * @param endTime
     * @return
     */
    List<GoodsRanking> selectGoodsRanking(@Param("userId") Integer userId, @Param("startTime") String startTime, @Param("endTime") String endTime);
}
